import scala.collection.mutable.HashMap
import layoutVariety.Widget
import layoutVariety.Label
import layoutVariety.TextBox
import layoutVariety.Button
import layoutVariety.CheckBox
import layoutVariety.RadioButton
import layoutVariety.ComboBox
import layoutVariety.Slider

package layoutVariety{
	object WidgetFactory
	{
	  private var count : Int = 0
	  private def getCountAndUpdate : Int =  
	  {
	    count = count + 1;
	    count;
	  }
	  
	  protected val widgetRef = HashMap[String, ()=>Widget]()
	  widgetRef("label") =  () =>  new Label(getCountAndUpdate);
	  widgetRef("textbox") =  () =>  new TextBox(getCountAndUpdate);
	  widgetRef("button") =  () =>  new Button(getCountAndUpdate);
	  widgetRef("checkbox") =  () =>  new CheckBox(getCountAndUpdate);
	  widgetRef("radiobutton") =  () =>  new RadioButton(getCountAndUpdate);
	  widgetRef("combobox") =  () =>  new ComboBox(getCountAndUpdate);
	  widgetRef("image") =  () =>  new Image(getCountAndUpdate);
	  widgetRef("slider") =  () =>  new Slider(getCountAndUpdate);
	  widgetRef("box") =  () =>  new Box(getCountAndUpdate);
	  widgetRef("overbox") =  () =>  new OverConstrainedBox(getCountAndUpdate);
	  widgetRef("underbox") =  () =>  new UnderConstrainedBox(getCountAndUpdate);
	  widgetRef("tab") =  () =>  new TabPanel(getCountAndUpdate);
	  
	  
  	  def getWidget(widgetType : String) : Widget = 
	  {
	    widgetRef(widgetType)();
	  }
	  
	}
}